<?php

class Db_Tables_SysToken extends Zend_Db_Table
{
    protected $_name = 'sys-token';
	var $userid;
	var $pwd;
	var $token;
	
    function VerifyToken()
	{
		$result = 0;
		
		if($this->userid && $this->token && $this->pwd)
		{
			$row = $this->fetchRow("userid = '".$this->userid."'");
			
			if($row->token)
			{
				$get_real_token = sha1($row->userid.$row->token);
				
				if($get_real_token == $this->token && sha1($this->pwd) == $row->pwd)
				{
					$result = 1;
				}
			}
		}
		
		return $result;
	}
}